package com.example.elm.Home_Page;

import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.elm.R;

public class Set_Note_Page extends AppCompatActivity {

    TextView finish, text_length;
    EditText set_note_text;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_set_note_page);

        text_length = findViewById(R.id.text_length);
        finish = findViewById(R.id.finish);
        set_note_text = findViewById(R.id.set_note_text);

        set_note_text.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void afterTextChanged(Editable editable) {
                text_length.setText("" + editable.length());
            }
        });

        finish.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Set_Note_Page.this, Check_Shop_Data_Page.class);
                intent.putExtra("note", set_note_text.getText().toString());
                setResult(1, intent);
                finish();
            }
        });
    }
}